package main

import (
	"fmt"
	"math/rand"
)

func printMultiTable() {
	for i := 1; i <= 9; i++ {
		for j := 1; j <= i; j++ {
			fmt.Printf("%d * %d = %-4d", j, i, i*j)
			// fmt.Printf("%d * %d = %d\t", j, i, i*j)
		}
		fmt.Println()
	}
}

func generateRandNum(count int) {
	sumResult, accumulateResult := 0, 1
	for i := 0; i < count; i++ {
		r := rand.Intn(100)
		// fmt.Println(r)
		if r%2 == 1 {
			sumResult += r
		} else {
			accumulateResult *= r
		}
	}
	fmt.Printf("100 以内随机数的累加值:%d 累积值为:%d\n", sumResult, accumulateResult)

}

func fibonacci(maxNum int) {
	i, j := 1, 1
	fmt.Printf("%d %d ", i, j)
	for {
		i, j = j, i+j
		if j >= maxNum {
			break
		}
		fmt.Printf("%d ", j)
	}
}

func main() {
	printMultiTable()
	generateRandNum(20)
	fibonacci(100)

}
